function show(infors, positions, icons) {
    var mapDiv = document.getElementById('map');
    var zoom = document.getElementById("changeZoom");
    var locate = document.getElementById("changeValues");
    var defaults = document.getElementById("backValues");
    var resetPols = document.getElementById('resetPols');
    var inforwindow;
    var bounds = new google.maps.LatLngBounds();
    var options = {
        center: new google.maps.LatLng(10.0341527, 105.7564947, 13), //Vị trí trung tâm Cần Thơ
        zoom: 13,
        mapTypeId: google.maps.MapTypeId.ROADMAP,
        mapTypeControl: true,
        mapTypeControlOptions: {
            style: google.maps.MapTypeControlStyle.DROPDOWN_MENU,
            position: google.maps.ControlPosition.BOTTOM_RIGHT
        },
        scaleControl: true
    };
    var map = new google.maps.Map(mapDiv, options);
    var route = new google.maps.MVCArray();
    var polylineOptions = {
        path: route,
        strokeColor: "#ff0000",
        strokeOpacity: 0.6,
        strokeWeight: 5
    };
    var markers = [];
    var ZOOM_SHOW = 14;
    var polylines = [];
    var circles = [];

    //Gọi các phương thức
    zoomOnchange();
    locateClick();
    backDefaultsClick();
    setPolyline();
    removePolylineClick();
    //Định nghĩa các phương thức
    function zoomOnchange() {
        //Thay đổi tỉ lệ zoom
        zoom.options[options.zoom].selected = true;
        zoom.onchange = function () {
            var val = zoom.value;
            if (val !== "Chọn") {
                showMarkers(val);
                map.setZoom(parseInt(val));
            }
        };
    }

    function locateClick() {
        //Vị trí 3 điểm marker
        locate.onclick = function () {
            removeMarkers();
            setAll();
        };
    }

    function backDefaultsClick() {
        //Trở về mặc định
        defaults.onclick = function () {
            removeMarkers();
            resetPolyline();
            map.setOptions(options);
        };
    }

    function setAll() {
        var video = document.createElement('video');
        video.setAttribute('src', 'videos/yeah.mp4');
        video.setAttribute('width', '300');
        video.setAttribute('height', '200');
        video.setAttribute('controls', 'controls');

        var detailDiv = document.createElement('div');
        detailDiv.style.width = '200px';
        detailDiv.style.height = '200px';
        mapDiv.appendChild(detailDiv);

        for (var i = 0; i < positions.length; i++) {
            bounds.extend(positions[i]);

            var pointMarker = new google.maps.Marker({
                position: positions[i],
                map: map,
                icon: icons[i],
                animation: google.maps.Animation.BOUNCE,
            });
            (function (i, pointMarker) {
                google.maps.event.addListener(pointMarker, 'click', function () {
                    if (!inforwindow)
                        inforwindow = new google.maps.InfoWindow();
                    switch (i)
                    {
                        case 0:
                            var overviewOpts = {
                                zoom: 14,
                                center: pointMarker.getPosition(),
                                mapTypeId: map.getMapTypeId(),
                                disableDefaultUI: true
                            };
                            var detailMap = new google.maps.Map(detailDiv, overviewOpts);
                            var detailMarker = new google.maps.Marker({
                                position: pointMarker.getPosition(),
                                map: detailMap,
                                clickable: false
                            });
                            inforwindow.setContent(detailDiv);
                            break;
                        case 1:
                            inforwindow.setContent(video);
                            break;
                        case 2:
                            inforwindow.setContent(infors[i]);
                            break;
                        default:
                            inforwindow.setContent(infors[i]);
                            break;
                    }
                    inforwindow.open(map, pointMarker);
                });
            })(i, pointMarker);

            map.fitBounds(bounds);
            if (map.getZoom() < ZOOM_SHOW)
                pointMarker.setVisible(false);
            markers.push(pointMarker);

            google.maps.event.addListener(map, 'zoom_changed', function () {
                var currentZoom = map.getZoom();
                showMarkers(currentZoom);
            });

        }
    }
    
    function showMarkers(currentZoom) {
        if (markers) {
            for (i in markers)
                if (currentZoom >= ZOOM_SHOW) {
                    markers[i].setVisible(true);
                    markers[i].setAnimation(google.maps.Animation.BOUNCE);
                }
                else
                {
                    markers[i].setVisible(false);
                    removeInfors();
                }
        }
        zoom.options[currentZoom].selected = true;
    }

    function removeMarkers() {
        if (markers) {
            for (i in markers)
                markers[i].setMap(null);
            markers.length = 0;
        }
    }

    function removeInfors()
    {
        if (inforwindow) {
            inforwindow.close();
        }
    }

    function setPolyline()
    {
        var polyline = new google.maps.Polyline(polylineOptions);
        polyline.setMap(map);
        google.maps.event.addListener(map, "click", function (e) {
            if (map.getZoom() === ZOOM_SHOW)
            {
                var path = polyline.getPath();
                path.push(e.latLng);
                var circleOptions = {map: map, center: e.latLng, radius: 5};
                var new_circle = new google.maps.Circle(circleOptions);
                polylines.push(polyline);
                circles.push(new_circle);
            }
            else
                alert('Vui lòng chọn độ zoom 14 để click tạo polyline!!!');
        });
    }

    function removePolylineClick()
    {
        resetPols.onclick = function () {
            resetPolyline();
        };
    }

    function resetPolyline()
    {
        if (polylines) {
            for (var idx = 0; idx < polylines.length; idx++) {
                polylines[idx].setPath([]);
            }
        }
        if (circles) {
            for (var idx = 0; idx < circles.length; idx++) {
                circles[idx].setMap(null);
            }
        }
        route.clear();
    }
}